﻿namespace EOrm
{
    /// <summary>
    /// 基础类
    /// </summary>
    public class EOrmBase
    {
        /// <summary>
        /// 条件语句的逻辑
        /// </summary>
        internal static WhereCondition WhereLogic { get; private set; } = WhereCondition.AND;

        /// <summary>
        /// 设置数据库表的条件语句的逻辑
        /// </summary>
        /// <param name="isAnd">指定该语句是否采用与逻辑，为假采用或逻辑</param>
        public static void SetWhereLogic(bool isAnd)
        {
            if (!isAnd)
            {
                WhereLogic = WhereCondition.OR;
            }
        }

        /// <summary>
        /// 排序语句的方式
        /// </summary>
        internal static OrderWay OrderMethod { get; private set; } = OrderWay.DESC;

        /// <summary>
        /// 设置数据库表排序语句的方式
        /// </summary>
        /// <param name="isDesc">指定该语句是否使用降序，为假采用升序</param>
        public static void SetOrderMethod(bool isDesc)
        {
            if (!isDesc)
            {
                OrderMethod = OrderWay.ASC;
            }
        }

        /// <summary>
        /// 数据库中的表列是否进行默认的下划线命名转换
        /// </summary>
        internal static bool IsChangeName { get; private set; } = true;

        /// <summary>
        /// 设置数据库表列是否进行默认的下划线命名转换
        /// </summary>
        /// <param name="isChangeName">指定时转换，为假不转换</param>
        public static void SetChangeName(bool isChangeName)
        {
            IsChangeName = isChangeName;
        }
    }
}
